<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2024-06-03
  Time: 19:25
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>ladder</title>
</head>
<body>
<%!
    public String ladderArea(double up, double down, double height) {
        return String.format("%.2f", (up + down) * height / 2);
    }
%>
<%
    Double up = 0.0d;
    Double down = 0.0d;
    Double height = 0.0d;
    try {
        up = Double.valueOf(request.getParameter("up"));
        down = Double.valueOf(request.getParameter("down"));
        height = Double.valueOf(request.getParameter("height"));
    } catch (Exception e) {
        e.printStackTrace();
    }
%>
<h1 class="active">
    上底为${param.up}，下底为${param.down}，高为${param.height}的梯形面积是：<%out.print(ladderArea(up, down, height));%>。
</h1>
</body>
</html>
